package cn.xp.web;

import cn.xp.domain.Floor;
import cn.xp.dto.DeviceTypeDto;
import cn.xp.dto.FloorDeviceDto;
import cn.xp.dto.FloorDto;
import cn.xp.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import cn.xp.service.IFloorService;

import java.util.List;

@RestController
@RequestMapping("/floor")
public class FloorController {

    @Autowired
    private IFloorService floorService;

    @PostMapping("/floorAdd")
    public JSONResult<Floor> floorAdd(@RequestBody Floor floor){
        System.out.println(floor);
        return floorService.floorAdd(floor);
    }

    @GetMapping("/floorList/{id}")
    public List<FloorDto> floorList(@PathVariable("id") Long id){
        return floorService.floorList(id);
    }

    @GetMapping("/floorType/{id}")
    public List<FloorDeviceDto> floorType(@PathVariable("id") Long id){
        return floorService.floorType(id);
    }

}
